package com.amumu.drama.mapper;

import com.amumu.drama.common.dto.GameOrderCount;
import com.amumu.drama.common.dto.OrderStatisticsDTO;
import com.amumu.drama.model.OmsOrder;
import com.amumu.drama.model.OmsOrderExample;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OmsOrderMapper extends BaseMapper<OmsOrder> {
    long countByExample(OmsOrderExample example);

    int deleteByExample(OmsOrderExample example);

    int deleteByPrimaryKey(Long id);

    int insert(OmsOrder record);

    int insertSelective(OmsOrder record);

    List<OmsOrder> selectByExample(OmsOrderExample example);

    OmsOrder selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") OmsOrder record, @Param("example") OmsOrderExample example);

    int updateByExample(@Param("record") OmsOrder record, @Param("example") OmsOrderExample example);

    int updateByPrimaryKeySelective(OmsOrder record);

    int updateByPrimaryKey(OmsOrder record);

    @Select("select min(id) from oms_order ${ew.customSqlSegment}")
    Long selectMinId(@Param(Constants.WRAPPER) Wrapper<OmsOrder> queryWrapper);

    OrderStatisticsDTO selectMemberStatistics(@Param("memberId") Long memberId);

    List<GameOrderCount> selectGameOrderStatistics(@Param("invitationType") String invitationType, @Param("invitationCode") String invitationCode);

    OrderStatisticsDTO selectOrderStatistics(@Param("invitationType") String invitationType, @Param("invitationCode") String invitationCode);
}